<?php

class Parser {

    public static function getHtmlPage($post_url, $post_data = false, $jsonDekode = false, $proxy = false) {
        
        if(!empty($post_data)){
            $data = '';
            foreach($post_data as $param => $value){
                $data .= $param.'='.$value.'&';
            }
        }
        
        //echo $post_url . "?". $data. "<br />";
        
        if( $curl = curl_init() ) {
            curl_setopt($curl, CURLOPT_URL, $post_url);
            curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
            
            if(!empty($data)){
                curl_setopt($curl, CURLOPT_POST, true);
                curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
            }
            
            $html = curl_exec($curl);
            
            curl_close($curl);
            
            return  $jsonDekode ? json_decode($html,1) : $html;
        }
    }

}